import cv2
import sys
from PyQt5.QtGui import QImage,QColor,QPixmap
from PyQt5.QtWidgets import QApplication, QWidget,QMainWindow,QLabel

app = QApplication(sys.argv)

img = cv2.imread("test2.png", cv2.IMREAD_UNCHANGED)
img = cv2.cvtColor(img, cv2.COLOR_RGB2RGBA)

h, w, channel = img.shape   # 高，宽，通道
print('shape',h,w,channel )
bytesPerLine = channel * w
QImg = QImage(img.data, w, h, bytesPerLine, QImage.Format_ARGB32)
print(QImg.width(),QImg.height())
QImg.save('qImage.png')
pixmap = QPixmap.fromImage(QImg)

win = QMainWindow()
win.show()
win.setGeometry(100,100,900,700)
label = QLabel(win)
label.setText('2313')
label.resize(win.size())
label.setPixmap(pixmap)
label.show()

sys.exit(app.exec_())
